/*
 * @Description: 数据返回模型
 * @Author: iamsmiling
 * @Date: 2021-07-11 18:48:34
 * @LastEditTime: 2021-07-11 19:31:26
 */
class BaseResponse{
    constructor(code,data,message){
        this.code = code;
        this.data = data;
        this.message = message;
    }

    

   toJson(){
       return {code:this.code,data:this.data,message:this.message}
   }
}

class SuccessResponse extends BaseResponse{
    constructor(data){
        super(0,data,"操作成功")
        this.data = data
    }
}

class ErrorResponse extends BaseResponse{
    constructor(code,message){
        super(code,{},message)
        this.data={}
    }
}

module.exports = {
    SuccessResponse,
    ErrorResponse,
    BaseResponse
}
